import {Component} from "react";
import {Link,Route} from "react-router-dom";
import React from "react";
import Detail from "./detail";
import querystring from 'query-string';

export default class Goods extends Component {

  state = {
  };

  render() {
    let {path,url} = this.props.match
    return (
      <div>
        <h3>商品</h3>
        <Link to="/goods/1">商品列表项目001 </Link>
        <Link to="/goods/2?a=1&b=2">商品列表项目002 </Link>
        <Link to={`${url}/3?a=11&b=22`}>商品列表项目003 </Link>

        <Link to={{pathname:`${url}/4`,search:'a=111&b=222'}}>商品列表项目004 </Link>
        <Link to={{pathname:`${url}/5`,search:querystring.stringify({a:123,b:456})}}>商品列表项目005 </Link>

        <Route path={`${path}/:_id`} component={Detail} />
      </div>
    )
  }
}